<!DOCTYPE html>
<html>
	<head>
		<title>Home</title>
		<!--bootstarp-css-->
		<link href="../css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
		<!--/bootstarp-css -->
		<!--css-->
		<link rel="stylesheet" href="../css/style.css" type="text/css" media="all" />
		<link href="../css/hover.css" rel="stylesheet" media="all">
		<!--领养-->
		<style>
			#search-top {
				z-index: 9999;
				background: #fff;
				padding: 10px;
			}

			#search-top .input-group-addon {
				border-radius: 0;
			}

			#loadLocation {
				border-right: none;
				color: #ff6735;
			}

			.panel-body {
				padding: 0 10px;
			}

			.panel-body .radio {
				padding-left: 30px;
			}

			label {
				font-weight: normal;
			}

			.page-container {
				width: 970px;
				margin: 10px auto;
			}

			.search-city {
				padding-right: 5px;
			}

			#addPost {
				margin-top: 80px;
			}

			#lingyang-list2 {
				margin: 10px 0;
			}

			#lingyang-list2 li {
				background: #fff;
				padding: 10px;
				position: relative;
				/* border-bottom: 2px #ccc solid; */
				box-shadow: 0 10px 6px -6px rgb(219, 219, 219);
				/* border-top: 2px #ccc solid; */

			}

			#lingyang-list2 a:hover {
				text-decoration: none;
			}

			#lingyang-list2 .media-heading {
				height: 30px;
				line-height: 30px;
				font-size: 18px;
				overflow: hidden;
				margin-bottom: 10px;
			}

			#lingyang-list2 .address {
				color: #999;
			}

			#lingyangList_page .fabu-btn {
				margin-bottom: 10px;
			}

			#lingyangList_page .panel {
				margin-bottom: 10px;
			}

			.ly-cell-con .media-heading .btn {
				position: absolute;
				left: 5px;
			}

			.ly-cell-con .figure .btn {
				position: absolute;
			}

			.xs-button {
				margin: 10px 10px 0;
				width: auto;
			}

			/* 筛选标签卡 */
			.mobile-nav .filter {
				/* font 16 */
				background: #f4f4f4;
				width: 100%;
				z-index: 1;
			}

			.mobile-nav .filter li {
				/* font 14 */
				float: left;
				width: 25%;
				text-align: center;
				font-size: 0.875em;
				height: 39px;
				line-height: 39px;
				padding-bottom: 1px;
				border-right: 1px solid #e4e4e4;
				border-bottom: 1px solid #e4e4e4;
			}

			.mobile-nav .filter li:last-child {
				border-right: none;
			}

			.mobile-nav .filter li a {
				font-size: 14px;
				color: #333;
				display: block;
			}

			.mobile-nav ul {
				margin-bottom: 0;
			}

			.mobile-nav li.filter_active {
				padding-bottom: 0;
				border-bottom-width: 2px;
				border-bottom-color: #ff9900;
			}

			.mobile-nav .f_condition a {
				display: block;
				text-indent: -10%;
				height: 39px;
				line-height: 39px;
				padding-bottom: 1px;

				background: url() no-repeat 74% 50%;
				background-size: 6px 9px;
			}

			.mobile-nav .f_condition_act a {
				background-image: url();
			}

			.mobile-nav .param-check-box {
				padding: 10px;
				background: #fff;
			}

			.param-check-box {
				position: relative;
				border-bottom: 1px solid #f1f2f4;
				padding-left: 5px;
			}

			.param-check-box ul {
				padding-top: 10px;
				padding-bottom: 0;
				margin-bottom: 0;
			}

			.param-check-box ul>li {
				line-height: 35px;
				margin-bottom: 10px;
			}

			.param-check-box ul>li input[type="radio"] {
				display: none;
			}

			.param-check-box ul>li .active {
				background: #f1f2f4;
			}

			.param-check-box ul>li .radio-inline {
				border: 1px solid #ccc;
				padding: 0 10px;
			}

			.param-check-box .btn {
				text-shadow: none;
				line-height: 35px;
				padding: 0 12px;
				margin-right: 10px;
				background: #fff;
				box-shadow: none;
				border: 1px solid #ccc
			}

			.param-check-box .btn.active {
				background: #f1f2f4;
			}

			#pack_up {
				bottom: 10px;
				position: absolute;
				right: 10px;
			}

			@media screen and (max-width: 768px) {
				#lingyangList_page {
					padding: 0;
				}

				#lingyang-list2 {
					margin: 0;
				}

				.search-city {
					padding-right: 0;
				}

				#search-top {
					background: #f1f2f4;
					padding: 0 10px;
				}

				.w-box {
					background-color: #fff;
					margin: 10px auto;
					padding: 10px;
					width: 100%;
				}
			}
		</style>
		<style>
			.form-control1,
			.form-control2 {
				width: 85%;
				height: 34px;
				font-size: 14px;
				line-height: 1.42857143;
				color: #555555;
				background-color: #fff;
				background-image: none;
				border: 1px solid #ccc;
				border-radius: 4px;
				transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
			}
		
			.form-control2 {
				width: 70%;
				height: 34px;
				font-size: 14px;
				line-height: 1.42857143;
				color: #555555;
				background-color: #fff;
				background-image: none;
				border: 1px solid #ccc;
				border-radius: 4px;
				transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
			}
		
			.form-control1:focus,
			.form-control2:focus {
				border-color: #66afe9;
				outline: 0;
				-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, 0.6);
				box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, 0.6);
			}
		
			.sidebar[data-color="purple"] .nav li.active a,
			.off-canvas-sidebar[data-color="purple"] .nav li.active a {
				background-color: #0c8687;
				box-shadow: 0 12px 20px -10px rgba(0, 190, 139, 0.3), 0 4px 20px 0px rgba(0, 208, 153, 0.1), 0 7px 8px -5px rgba(0, 153, 112, 0.2);
			}
		
			.modal-body button {
				width: 100px;
				height: 100px;
				border-radius: 50%;
				margin: 20px;
			}
		
			.aui-info {
				position: relative;
				    width: 480px;
				    height: auto;
				    text-align: center;
				    margin: 0 auto;
			}
		
			.aui-img-round {
				    width: 100px;
				    height: 100px;
				    /* border-radius: 50%; */
				    position: relative;
				    left: -140px;
				    border: 1px #ccc solid;
			}
		
			.fileInput {
				    width: 6.25rem;
				    height: 100px;
				    position: absolute;
				    top: 0px;
				    /* bottom: 300px; */
				    left: -135px;
				    right: 0;
				    opacity: 0;
				    display: block;
				    width: 100px;
				    clear: both;
				    display: block;
				    margin: auto;
				    background-color: red;
			}
		
			.fileInput1 {
				width: 6.25rem;
				height: 100px;
				position: absolute;
				top: 0;
				/* bottom: 300px; */
				left: 0;
				right: 0;
				opacity: 0;
				display: block;
				width: 100px;
				clear: both;
				display: block;
				margin: auto;
				background-color: red;
			}
		
			.info1 {
				width: 500px;
				margin-top: 15px;
				height: 230px;
				text-align: center;
			}
		
			.info1 div {
				float: left;
				width: 250px;
				height: 60px;
			}
		</style>
		<!--/css-->
		<style>
			.page-container a,
			.page-container a:hover {
				color: #0c8687;
				font-size: 14px;
				text-decoration: none;
			}

			.pagination>.active>a,
			.pagination>.active>span,
			.pagination>.active>a:hover,
			.pagination>.active>span:hover,
			.pagination>.active>a:focus,
			.pagination>.active>span:focus {
				z-index: 3;
				color: #fff;
				cursor: default;
				background-color: #0c8687;
				border-color: #0c8687;
			}

			.pagination>li>a {
				color: rgb(187, 187, 187);
			}

			.showuser span {
				font-size: 14px;
				color: #333;
				margin: 0 1px;
			}
			.pagination input {
				outline: none;
				border-radius: 4px;
				width: 50px;
				height: 36px;
				outline: none;
				border: 1px #DDDDDD solid;
				text-align: center;
			}
			
			#go-page {
				border: 1px #0c8687 solid;
				color: #fff;
				background: #0c8687;
			}
		</style>
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<script type="application/x-javascript">
			addEventListener("load", function() {
				setTimeout(hideURLbar, 0);
			}, false);

			function hideURLbar() {
				window.scrollTo(0, 1);
			}
		</script>
		<script src="../js/jquery.min.js"></script>
		<script src="../js/modernizr.custom.js"></script>
		<script src="../js/responsiveslides.min.js"></script>
		<script src="../js/jquery-3.2.1.min.js"></script>
        <script src="../js/bootstrap.min.js"></script>    
	</head>
	<body>
		
		<!-- 模态框（Modal）   寻宠详情显示-->
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="gridSystemModalLabel">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
								aria-hidden="true">&times;</span></button>
						<h4 class="modal-title">添加帖子</h4>
					</div>
					<form action="#" method="post" enctype="multipart/form-data">
						<div class="modal-body">
							<div class="aui-info">
								<div style="width: 30%;float: left;margin-top: 40px;">选择图片：</div>
								<div style="position: relative;">
									<img src="../images/pet-avatar.png" id="img-adopt" class="aui-img-round user-img">
									<input type="file" accept="image/*" id="file-adopt" name="file" onchange="upload('#file-adopt', '#img-adopt');" class="fileInput" value="">
								</div>
							</div>
							<div class="aui-info">
								<div style="width: 30%;float: left;margin-top: 30px;">帖子标题：</div>
								<div style="position: relative;height: 80px;line-height: 80px;">
									<input type="text" class="form-control forumtitle" value="" style="margin-left: -42px;display: inline-block;width: 70%;">
								</div>
							</div>
							<div class="aui-info" style="margin-bottom: 20px;">
								<div style="width: 30%;float: left;margin-top: 30px;">帖子内容：</div>
								<div style="position: relative;height: 80px;line-height: 80px;">
									<textarea cols="40" rows="4" class="form-control forumdetail" style="display: inline-block;width: 70%;margin-left: -40px;"></textarea>
								</div>
							</div>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal"
								style="width: 90px;outline: none;">取消</button>
							<button type="button" class="btn btn-primary addforum" style="width: 90px;outline: none;">添加</button>
						</div>
					</form>
				</div><!-- /.modal-content -->
			</div><!-- /.modal-dialog -->
		</div><!-- /.modal -->
		
		
		<!--header-->
		<div class="header">
			<div class="header-info">
				<div class="container">
					<div class="logo">
						<a href="index.html"><img src="../images/logo-pet.png" style="position: absolute;width: 330px;height: 262px;top: -60px;left: 280px;"/></a>
					</div>
					<div class="search-box">
						<form>
							<input type="text" name="s" class="textbox" placeholder="Search" required="">
							<input type="submit" value="">
						</form>
					</div>
					<div class="clearfix"> </div>
				</div>
			</div>
		</div>
		<div class="container">
			<div class="header-bottom">
				<div class="menu">
					<span class="menu-info"> </span>
					<ul class="cl-effect-21">
						<li id="oneser"><a id="service" href="index.html" class="active">服务中心</a>
							<div id="yican">
								<div>
									<p><a href="adopt.html">宠物领养</a></p>
									<p><a href="farmed.html">宠物寄养</a></p>
									<p><a href="notice.html">寻宠|招领</a></p>
								</div>
							</div>
						</li>
						<li><a href="petbaike.html">宠物百科</a></li>
						<li><a href="news.html">宠物新闻</a></li>
						<li><a href="bbs.html">宠物论坛</a></li>
						<li><a>关于我们</a></li>
						<li id="twoser">
							<a id="myme">个人中心</a>
							<div id="yincan">
								<div>
									<p><a href="myinfo.html">我的</a></p>
									<p><a id="overpet">注销</a></p>
								</div>
							</div>
						</li>
					</ul>
				</div>
				<style>
					#yincan {
						width: 160px;
						height: 110px;
						position: absolute;
						top: 70px;
						right: 46px;
						background-color: #fff;
						display: none;
					}
				</style>
				<!--yican -->
				<script>
					$("#service").mouseenter(function() {
						$("#yican").css("display", "block");
					});
					$("#oneser").mouseleave(function() {
						$("#yican").css("display", "none");
					});
					$("#myme").mouseenter(function() {
						$("#yincan").css("display", "block");
					});
					$("#twoser").mouseleave(function() {
						$("#yincan").css("display", "none");
					});
					//注销
					$("#overpet").click(function(){
						if(!confirm('是否确定注销该用户并退出登录？'))
						return;
						$.post('http://localhost:80/ct/remove',function(res){
							if(res){
								location.href='login.html';
							}
						});
					})
				</script>
				<!-- /yican -->
				<!--script-nav -->
				<script>
					$("span.menu-info").click(function() {
						$("ul.cl-effect-21").slideToggle("slow", function() {});
					});
				</script>
				<!-- /script-nav -->
				<div class="clearfix"> </div>
			</div>
		</div>
		<div class="page-container" style="position: relative;">
			<span class="label label-warning hidden-xs" style="position: absolute;top: 50px;left: 10px;">宠物论坛</span>
			<div class="row" id="lingyangList_page shop_list_page">
				<div class="col-md-12" style="margin-top: 10px;">
					<div class="pin-wrapper" style="height: 60px;">
						<div style="position: absolute;top: 35px;right: 25px;width: 40%;">
							<input type="text" class="input-success form-control" id="foruminfo"
								style="outline: none;width: 68%;display: inline-block;">
							<button class="btn btn-info btn-sm" id="search-button" style="outline: none;">查询</button>
							<button class="btn btn-success btn-sm" id="fatie" style="outline: none;" data-toggle="modal" data-target="#myModal">我要发贴</button>
						</div>
					</div>
					<div style="margin-top:10px">
						<ul class="media-list" id="lingyang-list2">
						<!-- 	<li class="media ly-cell-con">
								<div style="margin-bottom: 10px;">
									<span>
										<img src="../images/9.jpg"
											style="width: 40px;height: 40px;border-radius: 50%;" />
										<a id="user">rongewu2013</a>
									</span>
									<span style="color: #ccc;">|</span>
									<span>
										<a style="color: #333;" id="fbsj">2023-11-11 23:34:54</a>
									</span>
								</div>
								<a class="pull-left" href="AdoptDetails.html">
									<img src="../images/ad1.jpg" alt="我有一只蓝猫想找个好主人" style="width: 130px; height: 100px">
								</a>
								<div class="media-body">
									<a href="AdoptDetails.html">
										<h4 class="media-heading"> 网友惩罚犯错儿子，狗狗在旁边被吓得也不敢动</h4>
									</a>
									<div>
										<p style="height:auto; overflow: hidden;font-size: 14px;">如果你的兄弟姐妹因为做错</p>
									</div>
									<div style="text-align:right;margin-top: 10px;">
										<p style="font-size: 12px;color: #cdcdcd;">
											<span><a><img src="../images/read.png" width="20px" /></a><span
													id="readnum">234</span></span>&nbsp;&nbsp;&nbsp;
											<span><a id="review" title="评论"><img src="../images/review1.png"
														width="16px" /></a>评论</span>&nbsp;&nbsp;&nbsp;
											<span><a id="like" title="点赞"><img src="../images/ax3.png"
														width="20px" /></a>点赞</span>&nbsp;&nbsp;&nbsp;
											<span><a id="coll" title="收藏"><img src="../images/coll1.png"
														width="20px" /></a>收藏</span>&nbsp;&nbsp;&nbsp;
										</p>
									</div>
								</div>
							</li>
						 --></ul>
						<div class="clearfix" style="padding: 20px 0 0 0">
						</div>
						<div class="text-center hidden-xs" style="margin-left: 256px;">
							<ul class="pagination">
								<li class="active"><a href="javascript:void(0)" id="firstpage" title="首页">首页</a></li>
								<li><a href="javascript:void(0)" id="prevpage" title="上一页">上一页</a></li>
								<li><a href="javascript:void(0)" id="nextpage" title="下一页">下一页</a></li>
								<li><a href="javascript:void(0)" id="lastpage" title="最后一页">尾页</a></li>
								<li style="margin-left: 20px;">第<input type="text" id="pagenum" value="1" />页
									<input type="button" value="GO" id="go-page" style="" />
								</li>
							</ul>
						</div>

					</div>
				</div>
				
			</div>
		</div>

		<!--/header-->
		<!--footer-->
		<div class="footer">
			<div class="container">
				<div class="copy-rights">
					<p>Copyright &copy; 2023.Company <a target="_blank" href="index.html">you宠</a></p>
				</div>

			</div>
		</div>
		<!--/footer-->
		<script type="text/javascript">
			$(function() {
				let index = 1;
				let pages = 1;
				//自定义promise方法
				function getPromise(url, data) {
					return new Promise(function(resolve, reject) {
						$.post(url, data, function(res) {
							resolve(res);
						}, "json").fail(function(err) {
							reject(err);
						})
					});
				}
				$("#search-button").click(function() {
					index = 1;
					$("#pagenum").val(1);
					bbs();
					$("#foruminfo").val("");
				})
				//前往第几页
				$("#go-page").click(function() {
					let pagenum = $("#pagenum").val();
					if (pagenum > 0) {
						index = pagenum;
					}
					if (pagenum == 0) {
						alert("输入页码需大于0！");
						$("#pagenum").val(1);
						index = 1;
					}
					if (pagenum > pages) {
						alert("输入页码大于最大页数！");
						$("#pagenum").val(1);
						index = 1;
					}
					bbs();
				})
				//首页
				$("#firstpage").click(function() {
					index = 1;
					$("#pagenum").val(1);
					bbs();
				})
				//尾页
				$("#lastpage").click(function() {
					$("#pagenum").val(pages);
					index = pages;
					bbs();
				})
				//上一页
				$("#prevpage").click(function() {
					if (index >= 2) {
						index = index - 1;
						$("#pagenum").val(index);
					} else {
						alert("当前已是第一页！");
					}
					bbs();
				})
				//下一页
				$("#nextpage").click(function() {
					if (index < pages) {
						index = index + 1;
						$("#pagenum3").val(index);
					} else {
						alert("当前已是最后一页！");
					}
					bbs();
				})

				//显示论坛帖子
				bbs();

				function bbs() {
					$.post('http://localhost:80/ct/bbsAll', {
						"index": index,
						"title": $("#foruminfo").val()
					}, function(res) {
						console.log(res);
						$("#lingyang-list2").children().remove();
						$(res.records).each(function(i, e) {
						    let user="";//用户
							let file="";//头像
							let dz="";//地址
							//获取发帖用户信息
							getPromise('http://localhost:80/ct/userdetail', {
								"uid": e.fb_uid
							}).then(function(r) {
								user =r.username;
								file=r.filename;
								dz=r.faddress;
								if(e.fb_file == null){
									let trs = "<li class='media ly-cell-con'>" +
										"<div style='margin-bottom: 10px;' class='showuser'>" +
										"<span>" +
										"<img src='../images/"+file+"' style='width: 40px;height: 40px;border-radius: 50%;'/>" +
										"<span style='margin-left:5px'>"+user+"</span>" +
										"</span>" +
										"<span> | </span>" +
										"<span>" +
										"<span>" + e.fbdate + "</span>" +
										"</span>" +
										"<span> | </span>" +
										"<span>来自:" +
										"<span>"+dz+"</span>" +
										"</span>" +
										"</div>" +
										"<div class='media-body'>" +
										"<a href='bbsdetail.html?forumid=" + e.forumid + "'>" +
										"<h4 class='media-heading'>" + e.forumtitle + "</h4>" +
										"</a>" +
										"<div>" +
										"<p style='height:auto; overflow: hidden;font-size: 15px;'>" +
										e.forumdetail + "</p>" +
										"</div>" +
										"<div style='text-align:right;margin-top: 10px;'>" +
										"<p style='font-size: 12px;color: #cdcdcd;'>" +
										"<span><a><img src='../images/read.png' width='20px'/></a><span id='readnum'>" +
										e.readnum + "</span></span>&nbsp;&nbsp;&nbsp;" +
										"<span><a class='review' href='bbsdetail.html?forumid=" + e.forumid + "' onmouseenter='r1($(this))' onmouseleave='r2($(this))' title='评论'><img src='../images/review1.png' width='16px'/></a>评论</span>&nbsp;&nbsp;&nbsp;" +
										"<span><a class='like' href='bbsdetail.html?forumid=" + e.forumid + "' onmouseenter='l1($(this))' onmouseleave='l2($(this))' title='点赞'><img src='../images/ax3.png' width='20px'/></a>点赞</span>&nbsp;&nbsp;&nbsp;" +
										"<span><a class='coll' href='bbsdetail.html?forumid=" + e.forumid + "' onmouseenter='c1($(this))' onmouseleave='c2($(this))' title='收藏'><img src='../images/coll1.png' width='20px'/></a>收藏</span>&nbsp;&nbsp;&nbsp;" +
										"</p>" +
										"</div>" +
										"</div>" +
										"</li>";
									$("#lingyang-list2").append(trs);	
								}else{
									let trs = "<li class='media ly-cell-con'>" +
										"<div style='margin-bottom: 10px;' class='showuser'>" +
										"<span>" +
										"<img src='../images/"+file+"' style='width: 40px;height: 40px;border-radius: 50%;'/>" +
										"<span style='margin-left:5px'>"+user+"</span>" +
										"</span>" +
										"<span> | </span>" +
										"<span>" +
										"<span>" + e.fbdate + "</span>" +
										"</span>" +
										"<span> | </span>" +
										"<span>来自:" +
										"<span>"+dz+"</span>" +
										"</span>" +
										"</div>" +
										"<a class='pull-left' href='bbsdetail.html?forumid=" + e.forumid + "'>" +
										"<img src='../images/" + e.fb_file + "' style='width: 130px; height: 100px'>" +
										"</a>" +
										"<div class='media-body'>" +
										"<a href='bbsdetail.html?forumid=" + e.forumid + "'>" +
										"<h4 class='media-heading'>" + e.forumtitle + "</h4>" +
										"</a>" +
										"<div>" +
										"<p style='height:auto; overflow: hidden;font-size: 15px;'>" +
										e.forumdetail + "</p>" +
										"</div>" +
										"<div style='text-align:right;margin-top: 10px;'>" +
										"<p style='font-size: 12px;color: #cdcdcd;'>" +
										"<span><a><img src='../images/read.png' width='20px'/></a><span id='readnum'>" +e.readnum + "</span></span>&nbsp;&nbsp;&nbsp;" +
										"<span><a class='review' href='bbsdetail.html?forumid=" + e.forumid + "' onmouseenter='r1($(this))' onmouseleave='r2($(this))' title='评论'><img src='../images/review1.png' width='16px'/></a>评论</span>&nbsp;&nbsp;&nbsp;" +
										"<span><a class='like' href='bbsdetail.html?forumid=" + e.forumid + "' onmouseenter='l1($(this))' onmouseleave='l2($(this))' title='点赞'><img src='../images/ax3.png' width='20px'/></a>点赞</span>&nbsp;&nbsp;&nbsp;" +
										"<span><a class='coll' href='bbsdetail.html?forumid=" + e.forumid + "' onmouseenter='c1($(this))' onmouseleave='c2($(this))' title='收藏'><img src='../images/coll1.png' width='20px'/></a>收藏</span>&nbsp;&nbsp;&nbsp;" +
										"</p>" +
										"</div>" +
										"</div>" +
										"</li>";
									$("#lingyang-list2").append(trs);		
								}
								
							});
						});
						pages = res.pages;
					}, "json");
				}
	
			   //添加帖子
			$(".addforum").click(function(event) {
			   	event.preventDefault(); //阻止表单提交			 
			   	var formData = new FormData();
			   	if ($(".forumtitle").val() == '' || $(".forumdetail").val() == '') {
			   		alert("添加信息不能为空！");
			   		return;
			   	}   	
			   	formData.append("title", $(".forumtitle").val());
			   	formData.append("detail", $(".forumdetail").val());
			   	let f = document.getElementById('file-adopt');
			   	let f1 = f.files[0];
				// 判断是否选择上传图片
				if($("#file-adopt").val() == ''){
					//不上传
					$.post('http://localhost:80/ct/addforum1',{"title":$(".forumtitle").val(),"detail":$(".forumdetail").val()},function(r){
						if (r) {
							alert("添加成功！");
						} else {
							alert("添加失败！");
						}
						location.href = 'bbs.html';
					});
				}else{
					formData.append("files", f1);
					$.ajax({
						url: 'http://localhost:80/ct/addforum2',
						type: 'post',
						data: formData,
						contentType: false,
						processData: false,
						success: function(res) {
							console.log(res);
							if (res) {
								alert("添加成功！");
							} else {
								alert("添加失败！");
							}
							location.href = 'bbs.html';
						}
					})
				}							 
			   })   					
				// getPromise('http://localhost:80/ct/likenum',{"forumid":e.forumid}).then(function(r){
				// 	//点赞量
				// 	likenum = r;
				// 	return getPromise('http://localhost:80/ct/reviewnum',{"forumid":e.forumid});
				// }).then(function(r){
				// 	//评论量
				// 	reviewnum = r;
				// 	return getPromise('http://localhost:80/ct/collnum',{"forumid":e.forumid});								
				// })	
			})

			function r1(that) {
				that.children().attr("src", "../images/review2.png");
				that.parents("span").css("color", "#dbdbdb");
			}

			function r2(that) {
				that.children().attr("src", "../images/review1.png");
				that.parents("span").css("color", "#cdcdcd");
			}

			function l1(that) {
				that.children().attr("src", "../images/ax2.png");
				that.parents("span").css("color", "red");
			}

			function l2(that) {
				that.children().attr("src", "../images/ax3.png");
				that.parents("span").css("color", "#cdcdcd");
			}

			function c1(that) {
				that.children().attr("src", "../images/coll2.png");
				that.parents("span").css("color", "red");
			}

			function c2(that) {
				that.children().attr("src", "../images/coll1.png");
				that.parents("span").css("color", "#cdcdcd");
			}
		</script>
		<!-- 鼠标移入移出显示 -->
		<script type="text/javascript">
			$(".review").mouseenter(function() {
				$(this).children().attr("src", "../images/review2.png");
				$(this).parents("span").css("color", "#dbdbdb");
			});
			$(".review").mouseleave(function() {
				$(this).children().attr("src", "../images/review1.png");
				$(this).parents("span").css("color", "#cdcdcd");
			});
			$(".like").mouseenter(function() {
				$(this).children().attr("src", "../images/ax2.png");
				$(this).parents("span").css("color", "red");
			});
			$(".like").mouseleave(function() {
				$(this).children().attr("src", "../images/ax3.png");
				$(this).parents("span").css("color", "#cdcdcd");
			});
			$(".coll").mouseenter(function() {
				$(this).children().attr("src", "../images/coll2.png");
				$(this).parents("span").css("color", "red");
			});
			$(".coll").mouseleave(function() {
				$(this).children().attr("src", "../images/coll1.png");
				$(this).parents("span").css("color", "#cdcdcd");
			});
		</script>
		<!-- 分页 -->
		<script>
			$(function() {
				$(".pagination li").click(function() {
					$(this).children("a").css("color", "#fff");
					$(this).children("a").css("cursor", "default");
					$(this).children("a").css("background-color", "#0c8687");
					$(this).children("a").css("border-color", "#0c8687");
					$(this).siblings().children("a").css("color", "#bbb");
					$(this).siblings().children("a").css("cursor", "default");
					$(this).siblings().children("a").css("background-color", "#fff");
					$(this).siblings().children("a").css("border-color", "#ddd");
		
				})
			})
		</script>
		<!-- 图片预览 -->
		<script type="text/javascript">
			var upload = function(c, d) {
				"use strict";
				var $c = document.querySelector(c),
					$d = document.querySelector(d),
					file = $c.files[0],
					reader = new FileReader();
				reader.readAsDataURL(file);
				reader.onload = function(e) {
					$d.setAttribute("src", e.target.result);
				};
			};
		</script>

	</body>
</html>